package com.sie.demo.entity;

import java.util.List;

/**
 * @author liaozhifeng
 * @date 2021/7/27 10:28
 * @Version 1.0
 */
public class RetResponse {
    private final static String SUCCESS ="success";


    public static <T> RetResult<T> makeOKRsp() {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMessage(SUCCESS);
    }

    public static <T> RetResult<T> makeOKRsp(String message,T data,String token) {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMessage(message).setData(data).setToken(token);
    }
    public static <T> RetResult<T> makeOKRsp(String message, T data, String token, List list) {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMessage(message).setData(data).setToken(token).setList(list);
    }
    public static <T> RetResult<T> makeOKRsp(T data) {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMessage("").setData(data);}

    public static <T> RetResult<T> makeErrRsp(String message) {
        return new RetResult<T>().setCode(RetCode.FAIL).setMessage(message);
    }

    public static <T> RetResult<T> makeRsp(int code, String msg) {
        return new RetResult<T>().setCode(code).setMessage(msg);
    }
    public static <T> RetResult<T> makeRsp( String msg, T data) {
        return new RetResult<T>().setCode(RetCode.SUCCESS).setMessage(msg).setData(data);
    }

    public static <T> RetResult<T> makeRsp(int code, String msg, T data) {
        return new RetResult<T>().setCode(code).setMessage(msg).setData(data);
    }
}
